package com.example.administrator.myapplication.heart;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

import com.example.administrator.myapplication.R;


public class heartActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_heart);
        Toolbar toolbar = (Toolbar) this.findViewById(R.id.heard_main_toolbar);
        toolbar.setTitle("心肺耐力适能");
        toolbar.setTitleMarginStart(35);
        toolbar.setTitleTextColor(Color.parseColor("#ffffff"));
        toolbar.setNavigationIcon(R.mipmap.custom_back);
        setSupportActionBar(toolbar);
        getHeartMainFragment();
    }



    public void getHeartMainFragment() {
        heart_main_Fragment heartMainFragment = new heart_main_Fragment();
        FragmentManager fm = this.getFragmentManager();            //设置fragment管理器
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.fragment_heart, heartMainFragment);      //替换当前的fragment
        ft.commit();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.testmenu,menu);
        return true;
    }
}
